﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Review.aspx.cs" Inherits="Workflow.Review" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <%--<link href="Css/css.css" rel="stylesheet" type="text/css" />--%>
    <link type="text/css" rel="stylesheet" href="css/pagination.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    
    <script type="text/javascript" src="Scripts/MyJquery.js"></script>
    <script type="text/javascript" src="Scripts/jquery.js"></script>
    <script type="text/javascript" src="Scripts/jquery.pagination.js"></script>
    <script type="text/javascript" src="Scripts/Pageination.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <div id="Pagination" class="pagination definewidth m10"></div>
         <table class="table table-bordered definewidth m10">
            <thead>
                <tr>
                    <th></th>
                    <th>Id</th>
                    <th>创建人</th>
                    <th>工作流名称</th>
                    <th>标题</th>
                    <th>节点名称</th>
                    <th>创建时间</th>
                    <th>紧急程度</th>
                    <th>退回原因</th>
                    <th></th>
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>               
            </thead>
            <tbody id="Searchresult"></tbody>
            <tbody id="hiddenresult" style="display:none">
                <% for (int i = 0; i < resultList.Count; i++) %>
                <% { %>
                <tr class="result">
                    <%if(resultList[i].IsRead==0) {%>
                        <td><a class="Read" href="Server.ashx?WorkChildId=<%=resultList[i].WorkChildId %>&Type=Read"><img src="Images/未读.png" /></a></td>
                    <% }%>
                     <% else{%>
                        <td><a class="Read"><img src="Images/已读.png" /></a></td>
                    <% }%>
                    <%if(resultList[i].ChildStatusNo==-1) {%>
                        <td class="yellowColor"><% =resultList[i].WorkParentId %></td>
                    <% }%>
                    <% else{%>
                        <td><% =resultList[i].WorkParentId %></td>
                    <% }%>
                    <td><% =resultList[i].CreaterDisplayName %></td>
                    <td><% =resultList[i].WorkName %></td>
                    <td><% =resultList[i].Content %></td>
                    <td><% =resultList[i].NodeName %></td>
                    <td><% =resultList[i].CreateTime %></td>
                    <td><% =resultList[i].Critical %></td>
                    <%if (resultList[i].ReturnReason != "")
                      {%>
                        <td class="redColor"><% =resultList[i].ReturnReason %></td>
                    <%} else{%>
                        <td><% =resultList[i].ReturnReason %></td>
                    <%}%>
                    <td><a class="DetailUrl" href="<% =resultList[i].WebName %>?WorkParentId=<%= resultList[i].WorkParentId %>">详情</a></td>
                    <td><a class="Pass" href="Server.ashx?WorkParentId=<%= resultList[i].WorkParentId %>&WorkChildId=<%= resultList[i].WorkChildId %>&ParentStatusNo=<%= resultList[i].StatusNo %>&ChildStatusNo=<%= resultList[i].ChildStatusNo %>&IsSingleNode=<%= resultList[i].IsSingleNode %>&ChildNodeNo=<%= resultList[i].ChildNodeNo %>&NodeCount=<%= resultList[i].NodeCount %>&Type=Pass"><img src="Images/572.png" title="通过"/></a></td>
                    <%if(resultList[i].IsSingleNode==1) {%>
                        <td><a class="Return" href="ReturnReason.aspx?WorkParentId=<%= resultList[i].WorkParentId %>&WorkChildId=<%= resultList[i].WorkChildId %>&ParentStatusNo=<%= resultList[i].StatusNo %>&ChildStatusNo=<%= resultList[i].ChildStatusNo %>&Type=Return"><img src="Images/540.png" title="退回"/></a></td>
                    <% }%>
                    <% else{%>
                        <td><a class="Pause" href="Server.ashx?WorkParentId=<%= resultList[i].WorkParentId %>&WorkChildId=<%= resultList[i].WorkChildId %>&ParentStatusNo=<%= resultList[i].StatusNo %>&ChildStatusNo=<%= resultList[i].ChildStatusNo %>&Type=Pause"><p>暂停</p></a></td>
                    <% }%>
                    <td><a class="UpLoad" href="UpDownLoad.aspx?WorkParentId=<%= resultList[i].WorkParentId %>"><img src="Images/176.png" /></a></td>
                </tr>
                <% }%>
            </tbody>
         </table>
    </div>
    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            $(".DetailUrl").click(function () {
                var url = $(this).attr("href");
                openWin(url, 720, 500);
                return false;
            });
            $(".Pass").click(function () {
                var url = $(this).attr("href");
                var tr = $(this).parent().parent();
                $.ajax({
                    type: "Get",
                    url: url,
                    success: function (data) {
                        if (data>0) {
                            tr.remove();
                            alert("工作流序号" + data + "已被提交");
                        } else {
                            var workflow = $.parseJSON(data);
                            //alert(workflow.WorkParentId);
                            var sendUrl = "SendInfo.aspx?WorkParentId=" + workflow.WorkParentId;
                            //sendUrl += "&WorkChildId=" + workflow.WorkChildId;
                            sendUrl += "&NodeNo=" + workflow.StatusNo;
                            //sendUrl += "&ChildStatusNo=" + workflow.ChildStatusNo;
                            //sendUrl += "&IsSingleNode=" + workflow.IsSingleNode;
                            //sendUrl += "&ChildNodeNo=" + workflow.ChildNodeNo;
                            //sendUrl += "&Type=Pass";
                            openWin(sendUrl, 720, 500);
                        }
                        
                    }
                });
                return false;
            });
            $(".Return").click(function () {
                //var url = $(this).attr("href");
                //var tr = $(this).parent().parent();
                //if (confirm("确认退回此工作流？")) {
                //    DelTr(url, tr, "工作流序号", "已被退回")
                //}
                var url = $(this).attr("href");
                openWin(url, 720, 500);
                return false;
            });
            $(".Pause").click(function () {
                var url = $(this).attr("href");
                var tr = $(this).parent().parent();
                if (confirm("确认暂停此工作流？")) {
                    tr.children(":first").attr("class", "yellowColor");
                    $.ajax({
                        type: "get",
                        url: url,
                        success: function (data) {
                            alert("工作流序号" + data + "已被暂停");
                        }
                    });
                }
                return false;
            });
            $(".UpLoad").click(function () {
                var url = $(this).attr("href");
                openWin(url, 720, 500);
                return false;
            });
            $(".Read").click(function () {
                var url = $(this).attr("href");
                var img = $(this).find('img');
                $.ajax({
                    type: "get",
                    url: url,
                    success: function (data) {
                        img.attr('src', 'Images/已读.png');
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>
